import validate from '../../utils/Validation'

// 校验规则
const SCHEMA = {
    type: "object",
    required: ["type","code", "password","email"],
    properties: {
        type: {
            type: 'string',
            enum: [
                '100',
                '101'
            ]
        },
        code: {
            type: 'string',
            minLength: 1
        },
        password: {
            type: 'string',
            maxLength: 255,
            minLength: 6
        },
        email: {
            type: 'string',
            pattern: '^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$'
        }
    }
}
/**
 * 获取检验函数
 * @param data 
 * @returns 
 */
function validation(data = {}){
    return validate(SCHEMA, data)
}
export default validation